package com.graduation.lastproject.util.config;

import java.io.FileWriter;
import java.io.IOException;

public class AlipayConfig {

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号,开发时使用沙箱提供的APPID，生产环境改成自己的APPID
    public static String APP_ID = "2016101900721061";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String APP_PRIVATE_KEY = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCpG2uCTMdsjrH7a1JeldZRPEgclOMFK1wVtc3TglbZMtbbA/4lYCf6jY7768fQyJdSva6nIo+F8JA1oO1YnKCT+TDcoK0EpcN82xignN6HrPy0El7q8c0tRjDV9DHHKoD4V+GSFPDA1XPgPPOU+qvHVkBU7kwwz/IcriAp7xhLqJ0cj6PgC2rm6+VzILDshET3tG7Fn2tcw3iINhUD9qSplvCSpi3UHraiCCu7AjBMV9alyJouYjX8HDa2p2cJaFVM+sAHB7FYqPYz+u4cKDRCGNx9n4W4NBoDRL5jFxjwSBJqTKopnwqTkNWtOELKJLo7Fq7GubKOYdxu5PrjTr9ZAgMBAAECggEBAICjIBP9TdIxdgh36i+TMXWYMo6zX0ImaqUFKC4VvvT37GKsVd6el6rLlhHimJwkip/hNINlEeJkTX7ODN5UPv5xF48tFpArfFp02/YJfmmc2JouQ0/bYiVneGy4lkkX9wVy7F9QWJeHh97y3qPcT2GSJdu1bfXPqS/R8RuVClk6B4nO8GX2OI/cwV8ArKSLoHnvePBbE5WBF2KldvKTJjZvSGEVTVRW0jCwncrk4PIxzJICvxRNOR4BKV3t3craBQ4iUrUcC9R0QazAsIe8LSmU15O73gY6zvNK7QRpIVvbCh3rgqEJp67inbDs3xUOKm4DVOC+BJl6VOGofl7oxOUCgYEA+XvRq3HOyqeEP8lBJZItPBV/weo+fowS5IChpp3vB/XCtcs43V864qPw5oSeRKLx2rDOmD9CtMLOG3JRm+GlQ6/xzYItFZoJYRXqpsyBLqIFLKDbPuLCTola825kBPHEObqEISHc9oa4E3o7K4VOVCadZwaMYjn0UkTvmvJNFucCgYEArYYpDTKMZFIXAR2iK+aMGxb8C8e0uutra1h3+DA75MVCmBT0BWtVMBKOJTfbAmjpwySo04sZn3k5sU3BwAoOcTZ1nfj1skJrmrhDeAkwrIW36rUm/BopyiFb8HSrp2hSWB/julmgIbJNmtIKTa+W+lGs0RFk7NWxrOsVGrkv778CgYAeVwJ+mQ6O8qRQpYb4rLg3kF3DFVuYRCygAUynWJmTHD4boaU+trAQk+NeBU7CBhbng4z8UuUn2nD6QYLPNDfG7YS4e1ZEREFTvziUJFapdyat8Ln5AdajemzHIeuj9krowlgDN30JtgR4yeqcNk/6R9/ogZFc+LNPtfZ1n3XkjQKBgCg9enujA0eoeck6dAc2Obt2gxDASTsnqQuFwpx9owYUcLMP+N7g2yqAwxICd/mBFuS4NaaJFXIUDLr/SzUbn+nFNVVjDKdAG/APVyYZC36Wq+X0CIxiDNrhDY8fn0b9PEtPaeInMqldzf1fRCBr3dlC447AN+VsUP3Grmg6FdHFAoGBAJUXkz8wh5fhlHt1piwqo/1NZFHh9OXInCk+11kYnk2IPVzuv/H/3OHpfXEF3fBngFV8G4jpBHgSVwt6KKJblgA6HMjj/S9h6qjTT9dB1mD1xL3nlccWInUtiXWH2I1163EErNA+DmMV3zy2ClWmzHlfP43kI8CESzRN90UXzeyg";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    /*public static String ALIPAY_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm6A/xyVjR/WcGMKRFszdN9l7z5vSoBgyzwNxJ8T4geluH/" +
            "Qh1OOTVBNn6qpMYo6xEVy1LTzfPgOBs1286XLadS+vQU+i1rxrXcDYYRZhwPb1AG7zlM9mtUxXtSQyxh5ScZuOZDnIHYPYjl7E/" +
            "ewl7Ep7tomN0TxTagNovZgPpdYKCU0QiKaNAfTNyjCEK8Nh5YkanaQ+ICMbvIptch6ex04AF/MZc1Nmz0nfuPs7ohxFYrOQA" +
            "JrvmcI5geSwcSvdt+C0e84eQmn10h3oKS9CXH3Rx4DApt4hIOzZTIx/SuCQIqe2kJcZmuW2fDXW9Sh2HVHwqzRlp0fbzhO2h71BQwIDAQAB";*/
    public  static  String ALIPAY_PUBLIC_KEY="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkW3vofH9cv918dX3LS3/XrKoV4fq0hu+R7ZhwVsIg3QcXa/D9lk66Xq+sCWqjwE1DjD+ZBAfD4VSCcCwv4dAkk7LkCNXOeSodY0+0fBNqCnN5tBfdbVvlLio7MtH5jptJyfHcBHz5ro2AQ/tnxqymbUN9n8dXR1xccDvuQthJgqrV789rUth7pU9khaPYexKnVlGM7STbUOIE0HYvIXczKoxBYwYD4N4MfpFL4t6eBh7JLL6NgVmz1Yx/lMeFwrQyS" +
            "/sdxnGsZudWkybwLvAuZV0eKqfwqzE2zAc9Ogmu7wRTA2wEeOTBAj92zqz24G7AQ10xTOr9AvR7VlhEYxBrQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    /*public static String notify_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";*/
    public static String notify_url = "http://sgnnzn.natappfree.cc/alipayNotifyNotice";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问(其实就是支付成功后返回的页面)
    public static String return_url = "http://localhost:8080/alipayReturnNotice";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String CHARSET = "UTF-8";

    // 支付宝网关，这是沙箱的网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

